|
|
|
|
|
|
|
Learn about the built-in Visual Basic functions |
|
|
|
|
|
|
|
|
Learn about string functions |
|
|
|
|
|
|
|
|
Learn about date functions |
|
|
|
|
|
|
|
|
Sample Project File: \Chapter10\VBFuncs.vbp |
|
|
|
|
|
|
|
|
Visual Basic has many built-in functions that are a part of the base language and may be called at any time from your procedures. Table 10.1 is a list of some of the more common ones youll use. A complete list of functions can be found in the Visual Basic Books Online. |
|
|
|
|
|
|
|
|
Notice that many of the functions have two formswith a trailing dollar sign ($) and without. Those with the dollar sign return a value as a String data type. Those without it return a value as a variant data type with the VarType string. |
|
|
|
|
| Table 10.1 Most Commonly Used Built-in Functions. | | Function(s) | Description | | Chr, Chr$ | Convert an ASCII value to a string | | Asc | Converts a string to an ASCII value | | Str, Str$ | Convert a number to a string | | Format, Format$ | Convert a number to a formatted string | | Val | Converts a string to a number | | Date, Date$ | Get current system date | | Now | Gets current system date and time | | Time, Time$ | Get current system time | | InputBox, InputBox$ | Display an input box and prompt the user for one string | | MsgBox | Displays a message box | | LCase, LCase$ | Convert a string to lowercase | | UCase, UCase$ | Convert a string to uppercase |
|
|
|
|
|
|
(table continued to next page) |
|
|
|
|
|